<template>
  <div class="col_form">
    <p class="color-666" style="line-height:35px">{{ title }}</p>
      <capsule-banner></capsule-banner>
    <!-- <el-row>
      <el-col :span="12">
        <capsule-banner></capsule-banner>
      </el-col>
      <el-col :span="12">
        <capsule-banner></capsule-banner>
      </el-col>
    </el-row> -->
  </div>
</template>

<script>
import CapsuleBanner from '../child/capsuleBanner.vue'
import bannerFormVue from './bannerForm.vue'
export default {
  components: { CapsuleBanner, bannerFormVue },
  props: {
    contentType: {
      type: String,
      default: 'goods'
    },
    goodsNum: {
      type: Number,
      default: 0
    },
    title: {
      type: String,
      default: ''
    },
    formData: {
      type: Object,
      default: () => ({})
    },
    type: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      banner: {
        img: '',
        jumpType: '',
        jumpUrl: '',
        goods: {}
      },
      goodsList: [],
      goods: [
        {
          imgurl: ''
        },
        {
          imgurl: ''
        }
      ]
    }
  },
  methods: {
    // 添加商品
    openSelect() {
      this.$refs.goodsDialog.dialogVisible = true
      this.$refs.goodsDialog.selectItems = [...this.goodsList]
    },
    // 设置选中
    setSelect(goodsList) {
      this.goodsList = goodsList
    },
    // 升序
    upSort(index) {
      if (index === 0) {
        return
      }
      const item = this.goodsList[index]
      this.$set(this.goodsList, index, this.goodsList[index - 1])
      this.$set(this.goodsList, index - 1, item)
    },
    // 降序
    downSort(index) {
      if (index === this.goodsList.length - 1) {
        return
      }
      const item = this.goodsList[index]
      this.$set(this.goodsList, index, this.goodsList[index + 1])
      this.$set(this.goodsList, index + 1, item)
    },
    // 删除商品
    deleteGoods(index) {
      this.goodsList.splice(index, 1)
    }
  }
}
</script>

<style lang="scss" scoped>
.col_form {
  .input_wrapper {
    margin-top: 10px;
    margin-left: 0;

    &>div {
      label {
        width: 90px;
      }
    }
  }
}
</style>
